package com.topvision.myviewtest.viewpager;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

/**
 * @author lucy
 * @date 2018-09-20 11:24
 * @description //TODO
 */

public class StatePagerAdapter extends FragmentStatePagerAdapter {
    private Fragment[] mFragments;
    private String[] mTitles;

    public StatePagerAdapter(FragmentManager fm, Fragment[] fragments, String[] titles) {
        super(fm);
        mFragments = fragments;
        mTitles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments[position];
    }

    @Override
    public int getCount() {
        return mFragments.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
